import { seedData } from "./seeds";

export const store = {
    state: {
        seedData
    },
    getActiveDay() {
        return this.state.seedData.find((day) => day.active);
    },
    setActiveDay(dayId) {
        this.state.seedData.map((dayObj) => {
            dayObj.id === dayId ? dayObj.active = true : dayObj.active = false        
        })
    },
    submitEvent(eventDetails) {
        //得到当前日
        const activeDay = this.getActiveDay();
        //追加event
        activeDay.events.push({"details": eventDetails, "edit": false});
    }
}